package com.pd.kit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by dong peng
 * DATE : 2017/3/9
 * TIME : 23:34.
 */


public class LogUtil {

    protected static Logger log = LoggerFactory.getLogger(LogUtil.class);


    public static void debug(String message) {
        log.debug(message);
    }

    public static void info(String message) {
        log.info(message);
    }

    public static void warn(String message) {
        log.warn(message);
    }

    public static void error(String message, Throwable th) {
        StringBuilder sb = new StringBuilder(message);
        sb.append("信息：").append(th.getMessage()).append(",原因：").append(th.getCause()).append("\r\n");
        for(StackTraceElement element : th.getStackTrace()) {
            sb.append(element.toString()).append("\r\n");
        }
        log.error(sb.toString());
    }

}
